home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.image;
-
- import java.awt.image.ImageConsumer;
-
- class ImageConsumerQueue {
- ImageConsumerQueue next;
- ImageConsumer consumer;
- boolean interested;
- Object securityContext;
- boolean secure;
-
- ImageConsumerQueue(InputStreamImageSource src, ImageConsumer ic) {
- this.consumer = ic;
- this.interested = true;
- if (ic instanceof ImageRepresentation) {
- ImageRepresentation ir = (ImageRepresentation)ic;
- if (ir.image.source != src) {
- throw new SecurityException("ImageRep added to wrong image source");
- }
-
- this.secure = true;
- } else {
- SecurityManager security = System.getSecurityManager();
- if (security != null) {
- this.securityContext = security.getSecurityContext();
- } else {
- this.securityContext = null;
- }
- }
-
- }
-
- static boolean isConsumer(ImageConsumerQueue cqbase, ImageConsumer ic) {
- for(ImageConsumerQueue cq = cqbase; cq != null; cq = cq.next) {
- if (cq.consumer == ic) {
- return true;
- }
- }
-
- return false;
- }
-
- static ImageConsumerQueue removeConsumer(ImageConsumerQueue cqbase, ImageConsumer ic, boolean stillinterested) {
- ImageConsumerQueue cqprev = null;
-
- for(ImageConsumerQueue cq = cqbase; cq != null; cq = cq.next) {
- if (cq.consumer == ic) {
- if (cqprev == null) {
- cqbase = cq.next;
- } else {
- cqprev.next = cq.next;
- }
-
- cq.interested = stillinterested;
- break;
- }
-
- cqprev = cq;
- }
-
- return cqbase;
- }
-
- public String toString() {
- return "[" + this.consumer + ", " + (this.interested ? "" : "not ") + "interested" + (this.securityContext != null ? ", " + this.securityContext : "") + "]";
- }
- }
-